package org.zfes.snowier.cloud.zbss.cms.router.service.checkFlow;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.checkFlow.model.CmsCheckFlow;
import org.zfes.snowier.cloud.zbss.cms.checkFlow.service.ICmsCheckFlowService;
@Controller 
@RequestMapping("/cms/checkFlow/cmsCheckFlow")
public class CmsCheckFlowController extends BaseController {

	
	@Autowired
	private ICmsCheckFlowService cmsCheckFlowService;
	
	@RequiresPermissions(value="cmsCheckFlow:loadCmsCheckFlowDataSet",desc="流程定义列表")
    @RequestMapping(value="/loadCmsCheckFlowDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsCheckFlowDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsCheckFlowService.loadCmsCheckFlowDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsCheckFlow:createCmsCheckFlow",desc="流程定义添加")
    @RequestMapping(value="/createCmsCheckFlow", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsCheckFlow(CmsCheckFlow cmsCheckFlow){
		cmsCheckFlowService.createCmsCheckFlow(cmsCheckFlow);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsCheckFlow:loadCmsCheckFlow",desc="流程定义加载")
    @RequestMapping(value="/loadCmsCheckFlow", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsCheckFlow(Long id){
		Optional<CmsCheckFlow> ops = cmsCheckFlowService.loadCmsCheckFlowById(id);
		return ajaxQuery("cmsCheckFlow",ops);
    }
	
	@RequiresPermissions(value="cmsCheckFlow:updateCmsCheckFlow",desc="流程定义更新")
    @RequestMapping(value="/updateCmsCheckFlow", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsCheckFlow(CmsCheckFlow cmsCheckFlow){
		cmsCheckFlowService.updateCmsCheckFlow(cmsCheckFlow);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsCheckFlow:deletCmsCheckFlow",desc="流程定义删除")
    @RequestMapping(value="/deleteCmsCheckFlow", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsCheckFlow(Long id){
		cmsCheckFlowService.deleteCmsCheckFlow(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}